<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>对象继承</title>
</head>

<body>
    <script>
        //ES5构造函数来使用
        //手机
        function Phone(brand, price) {
            this.brand = brand;
            this.price = price;
        }
        Phone.prototype.call = function () {
            console.log('我打电话功能');
        }

        //智能手机
        function SmartPhone(brand, price, color, size) {
            Phone.call(this, brand, price);
            this.color = color;
            this.size = size;
        }
        //设置子级构造函数的原型
        SmartPhone.prototype.phone = function () {
            console.log('卡擦卡擦来拍照');
        }
        SmartPhone.prototype.playGame = function () {
            console.log('我可以玩游戏啊');
        }
        const chuizi = new SmartPhone('锤子', 4999, '珍珠黑', '5.5inch');
        console.log(chuizi);
        chuizi.phone()
    </script>
</body>

</html>